﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace SYFramework
{
    public  class ISubject
    {
        public List<IObserver> observersList=null;

        public ISubject()
        {
            observersList = new List<IObserver>();
        }
        public void AddObserver(IObserver observer)
        {
            observersList.Add(observer);
        }

        public void RemoveObserver(IObserver observer)
        {
            observersList.Remove(observer);
        }

        public  void Notfice(EventBase uIEventBase)
        {
            foreach (var item in observersList)
            {
                item.Update(uIEventBase);
            }
        }
        
    }

    public class UISubject : ISubject
    {

        public UISubject() : base()
        {
        }

      
    }


    public class EnemySubject : ISubject
    {
        public EnemySubject() : base()
        {
        }
    }

}
